<template>
  <div class="bottoms-border">
    <div class="now_foot">{{ date }}</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      date: null,
      timer: null
    };
  },
  mounted() {
    let _this = this; // 声明一个变量指向Vue实例this，保证作用域一致
    this.timer = setInterval(() => {
      _this.date = new Date(); // 修改数据date
    }, 1500);
  },
  beforeDestroy() {
    if (this.timer) {
      clearInterval(this.timer); // 在Vue实例销毁前，清除我们的定时器
    }
    this.timer=null;
  }
};
</script>

<style scoped="scoped" lang="less">
.bottoms-border {
  width: 100%;
  min-width: 920px;
  height: 25px;
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 999999;
  background-image: linear-gradient(to bottom, #cecece, #c8c7c7, #b7b7b7, #adadad, #bcbcbc);
  box-sizing: border-box;
  padding-right: 10px;
  .now_foot {
    line-height: 25px;
    text-align: right;
  }
}
</style>
